<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>1：实现火狐切换搜索的功能,当选择哪个搜索，切换对应公司的logo图片，并且更改表单的action属性，
			当输入值并点击搜索的时候，能去对应的网站.三个网址分别是https://www.baidu.com,https://www.taobao.com
			和https://www.google.com.hk</title>
		<script>
			function sou(id) {
				var ac = ["https://www.baidu.com/s?", "https://www.google.com", "https://www.taobao.com"];
				var im = ["imgs/baidu_web.png", "imgs/google_web.png", "imgs/taobao_shopping.png"];
				var na = ["wd", "g", "p"];
				var te = ["百度一下", "谷歌", "找一找"];	
				var f=document.getElementById("d");
				if (id == 'bai') {
					f.action = ac[0];
					f.children[0].src = im[0];
					f.children[1].name = na[0];
					f.children[2].innerHTML=te[0];
				}else if (id == 'goo') {
					f.action = ac[1];
					f.children[0].src = im[1];
					f.children[1].name = na[1];
					f.children[2].innerHTML=te[1];
				}else if (id == 'tao') {
					f.action = ac[2];
					f.children[0].src = im[2];
					f.children[1].name = na[2];
					document.getElementById("d").children[2].innerHTML=te[2];
				}
			}
		</script>
	</head>
	<body>
		<div>
			<form id="d" action="https://www.baidu.com/s?" method="GET">
				<img src="imgs/baidu_web.png" alt="">
				<input type="text" name="wd">
				<button>百度一下</button>
			</form>
			<button  onclick="sou('bai')">百度</button>
			<button  onclick="sou('goo')">谷歌</button>
			<button  onclick="sou('tao')">淘宝</button>
		</div>
	</body>
</html>
